<br />
<div class="col-lg-9">
	<h1>Leitores</h1>  
</div>
<div class="col-lg-3 right">
	<br />
	<%= link_to 'Adicionar Novo Leitor', new_reader_path, class: 'btn btn-primary btn-block' %>  
</div>

<div class="content-panel">
	<table class="table table-striped table-advance table-hover">
  		<thead>
        	<tr>
            	<th> Descrição </th>
              	<th> IP </th>
              	<th> Status </th>
              	<th>  </th>
          	</tr>
        </thead>
        <tbody>
        	<% @readers.each do |reader| %>
        		<tr>
        			<td><%= reader.description %></td>
        			<td><%= reader.ip_address %></td>
        			<td>
        				<%= '<span class="label label-success label-mini"> Ativo </span>'.html_safe if reader.status %>
        				<%= '<span class="label label-warning label-mini"> Inativo </span>'.html_safe unless reader.status %>
        			</td>
        			<td>
        				<%= link_to '<i class="fa fa-pencil"></i>'.html_safe, edit_reader_path(reader), class: 'btn btn-primary btn-xs' %>
        				<%= link_to '<i class="fa fa-trash-o "></i>'.html_safe, reader_destroy_path(reader), id: "delete-#{reader.id}",  class: 'btn btn-danger btn-xs' %>
        				<script type="text/javascript">
							$(document).ready(function () {
								$("#delete-<%= reader.id %>").click(function( e ){
								   if(!confirm('Você realmente deseja remover este registro?')) {
								      e.preventDefault();		      
								   }
								});
							});
						</script>
        			</td>
        		</tr>
    		<% end %>    	
        </tbody>
    </table>
</div>